<!doctype html>
<html class="no-js fixed-layout" data-ng-app="audittest">
#include("/WEB-INF/tpl/head.vm")
<style>
    #edTable > tbody > tr > td {
        display: inline-block;
        word-wrap: break-word;
        height: 100px;
    }

    #edTable > thead > tr > th {
        display: inline-table;
        word-wrap: break-word;
    }


</style>
<div data-ng-controller="admin-question">
    <div class="am-cf am-padding">
        <div class="am-fl am-cf">
            <strong class="am-text-primary am-text-lg">首页</strong> /
            <small>题库管理</small>
        </div>
    </div>
    <div>
        <div class="am-in am-form-horizontal">
            <button type="button" class="am-margin-right am-btn am-btn-default" data-ng-click="add()">新增题目</button>
            <button type="button" class="am-margin-right am-btn am-btn-primary" data-ng-click="importQuestion()">导入题目
            </button>
            &nbsp;
            <button type="button" class="am-margin-right am-btn am-btn-danger" data-ng-click="deleteQuestion()">删除题目
            </button>
            &nbsp;序列:
            <select data-am-selected="{btnSize: 'sm'}" data-ng-options="a.seqbh as a.seqname for a in seqs"
                    data-ng-model="qseq"></select> &nbsp;分类:
            <select data-am-selected="{btnSize: 'sm'}" data-ng-options="a.catebh as a.catename for a in cates"
                    data-ng-model="qcate"></select>
            <button type="button" class="am-margin-right am-btn am-btn-search" data-ng-click="search()">检索</button>
        </div>
        <div class="am-scrollable-horizontal" style="overflow-x: auto;overflow-y: auto;">
            <table class="am-table am-table-bd am-table-striped admin-content-table" id="edTable">
                <thead>
                <tr>
                    <th style="width: 30px;">
                        <input type="checkbox" data-ng-model="checkall"/>
                    </th>
                    <th style="width: 50px;text-align: center">序号</th>
                    <th style="width: 420px;text-align: center">题目名称</th>
                    <th style="width: 100px;text-align: center">题目类型</th>
                    <th style="width: 50px;text-align: center">难度</th>
                    <th style="width: 100px;text-align: center">研发序列</th>
                    <th style="width: 120px;text-align: center">分类</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr data-ng-repeat="item in items">
                    <td style="width: 30px;text-align: center">
                        <input type="checkbox" data-ng-model="item.checked"/>
                    </td>
                    <td style="width: 50px;text-align: center">{{$index + 1}}</td>
                    <td style="width: 420px;overflow: auto">{{item.itemcontent}}</td>
                    <td style="width: 100px;text-align: center">{{item.itemtype}}</td>
                    <td style="width: 50px;text-align: center">{{reversdifficulties[item.itemlevel]}}</td>
                    <td style="width: 100px;text-align: center">{{reversseqs[item.itemseq]}}</td>
                    <td style="width: 120px;text-align: center">{{reverscates[item.itemcate]}}</td>
                    <td>
                        <button type="button" class="am-btn am-btn-primary" data-ng-click="edit(item)">编辑</button>
                        <button type="button" class="am-btn am-btn-danger" data-ng-click="deleteItem(item)">删除</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1">
        <div class="am-modal-dialog">
            <div class="am-modal-hd">
                新增/编辑 考题
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>
            <div class="am-modal-bd am-form am-form-horizontal">
                <div>
                    <table class="am-table am-table-bd am-table-striped admin-content-table">
                        <tr>
                            <td>考题编号</td>
                            <td>
                                <input data-ng-model="currentItem.itembh" type="text" readonly="readonly"/>
                            </td>
                        </tr>
                        <tr>
                            <td>考题</td>
                            <td>
                                <textarea data-ng-model="currentItem.itemcontent" style="width: 100%;"
                                          rows="3"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td>考题难度</td>
                            <td>
                                <select data-ng-options="l.value as l.label for l in difficulties"
                                        data-ng-model="currentItem.itemlevel"></select>
                            </td>
                        </tr>
                        <tr>
                            <td>考题类型</td>
                            <td>
                                <select data-ng-options="itemtype for itemtype in itemtypes"
                                        data-ng-model="currentItem.itemtype"></select>
                            </td>
                        </tr>
                        <tr>
                            <td>所属序列</td>
                            <td>
                                <select data-ng-options="seq.seqbh as seq.seqname for seq in seqs"
                                        data-ng-model="currentItem.itemseq"></select>
                            </td>
                        </tr>
                        <tr>
                            <td>所属分类</td>
                            <td>
                                <select data-ng-options="cate.catebh as cate.catename for cate in cates"
                                        data-ng-model="currentItem.itemcate"></select>
                            </td>
                        </tr>
                    </table>
                </div>
                <div data-ng-show="currentItem.itemtype=='单选题'">
                    <table class="am-table">
                        <tr data-ng-repeat="a in currentOptions">
                            <td style="padding-left: 30px;">{{a.optno}}</td>
                            <td>
                                <input type="radio" data-ng-model="a.isanswer" data-ng-value="true" name="group0"/>
                            </td>
                            <td>
                                <input type="text" data-ng-model="a.optcontent"/>
                            </td>

                        </tr>
                    </table>
                </div>
                <div data-ng-show="currentItem.itemtype=='多选题'">
                    <table class="am-table">
                        <tr data-ng-repeat="a in currentOptions">
                            <td>{{a.optno}}</td>
                            <td>
                                <input type="checkbox" data-ng-model="a.isanswer" name="group1"/>
                            </td>
                            <td>
                                <input type="text" data-ng-model="a.optcontent"/>
                            </td>

                            <!-- data-ng-checked="a.isanswer"  -->
                        </tr>
                    </table>
                </div>
                <div data-ng-show="currentItem.itemtype=='判断题'">
                    <table class="am-table">
                        <tr>
                            <td></td>
                            <td>
                                <input type="text" data-ng-model="currentOptions[0].truefalse" readonly="readonly"/>
                            </td>
                            <td>
                                <input type="radio" data-ng-model="currentOptions[0].isanswer" data-ng-value="true"
                                       name="group2"/>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <input type="text" data-ng-model="currentOptions[1].truefalse" readonly="readonly"/>
                            </td>
                            <td>
                                <input type="radio" data-ng-model="currentOptions[1].isanswer" data-ng-value="true"
                                       name="group2"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div data-ng-show="currentItem.itemtype=='问答题' || currentItem.itemtype=='名词解释' || currentItem.itemtype=='编程题' || currentItem.itemtype=='主观题' || currentItem.itemtype=='填空题'">
                    <textarea rows="2" cols="20" data-ng-model="currentOptions[0].optcontent"></textarea>
                </div>
                <button type="button" class="am-btn am-btn-primary" data-ng-click="postData()">提交</button>
            </div>
        </div>
    </div>

    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-2">
        <div class="am-modal-dialog">
            <div class="am-modal-hd">
                批量导入考题
                <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
            </div>
            <form method="post" enctype="multipart/form-data" id="submitFile">
                <div class="am-modal-bd am-form am-form-horizontal">
                    <div>
                        <table class="am-table am-table-bd am-table-striped admin-content-table">
                            <tr>
                                <td>所属序列</td>
                                <td>
                                    <select data-ng-options="seq.seqbh as seq.seqname for seq in seqs"
                                            data-ng-model="batchItem.itemseq"></select>
                                    <input data-ng-model="batchItem.itemseq" name="sq"
                                           style="height: 0px; width: 0px; position: absolute; top: -1000px;">
                                </td>
                            </tr>
                            <tr>
                                <td>所属分类</td>
                                <td>
                                    <select data-ng-options="cate.catebh as cate.catename for cate in cates"
                                            data-ng-model="batchItem.itemcate"></select>
                                    <input data-ng-model="batchItem.itemcate" name="ct"
                                           style="height: 0px; width: 0px; position: absolute; top: -1000px;">
                                </td>
                            </tr>
                            <tr>
                                <td>Excel</td>
                                <td>
                                    <input id="batchFile" type="file" name="batchFile"/>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <button type="button" class="am-btn am-btn-primary" data-ng-click="batchImport()">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
#include("/WEB-INF/tpl/footer.vm")

</html>